﻿namespace ICRprojekt
{
    /// <summary>
    /// Klasa služi za sviranje zvukova.
    /// </summary>
    public static class Zvuk
    {
        /// <summary>
        /// Varijabla player je instanca media playera koja služi za sviranje zvukova.
        /// </summary>
        private static readonly WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
        
        /// <summary>
        /// Metoda svira zvuk prema imenu. imena zvukova su: "woohoo", "doh", "dundundun", "clap" i "knock".
        /// </summary>
        /// <param name="naziv"></param>
        private static void Play(string naziv)
        {
            player.controls.stop();
            player.URL = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + @"\Zvukovi\"+naziv+@".mp3";
            player.settings.volume = 100;
            player.controls.play();
        }

        /// <summary>
        /// Metoda svira zvuk otvaranja pitanja.
        /// </summary>
        public static void Zvuk_OtvoriPitanje()
        {
            Play("knock");
        }
        /// <summary>
        /// Metoda svira zvuk za tocan odgovor.
        /// </summary>
        public static void Zvuk_Tocno()
        {
            Play("woohoo");
        }
        /// <summary>
        /// Metoda svira zvuk za netocan odgovor.
        /// </summary>
        public static void Zvuk_Netocno()
        {
            Play("doh");
        }
        /// <summary>
        /// Metoda svira zvuk za otvaranje jackpota.
        /// </summary>
        public static void Zvuk_OtvoriJackpot()
        {
            Play("dundundun");
        }
        /// <summary>
        /// Metoda svira zvuk za kraj igre.
        /// </summary>
        public static void Zvuk_UspjesanKraj()
        {
            Play("clap");
        }

        /// <summary>
        /// Metoda zaustavlja sviranje i gaasi media player.
        /// </summary>
        public static void Zatvori()
        {
            player.controls.stop( );
            player.close( );
        }
    }
}
